<?php
/**
*	file: intake2.php
*	path: /webroot/forms/
*	notes:   
*		this form was updated with VAIL customization on 10-17-08.
*		
*/
	//FOR DEBUGGING--comment out when done!
	ini_set('display_errors', 1);
	ini_set('error_reporting', E_ALL ^ E_NOTICE);
	error_reporting(1);

	session_start();

	$staffSig = $_SESSION['logged_in'];
	$staffGrievanceSig = $_SESSION['logged_in'];	
	//echo"<h1>".$staffSig."</h1>";
	//echo"<h1>".$staffGrievanceSig."</h1>";
	
	$query = "SELECT * 
			FROM intake2 
			WHERE consumer_id = ".$id;
			
$result = mysql_query($query);
if($row = mysql_fetch_array($result)) {

	$isGuardian = $row["is_guardian"];
	
	###################################################
	$isGuardianshipDocumented = $row["is_guardianship_documented"];
	$legalStatusID1 = $row["legal_status_id"];
	###################################################
	
	$guardianName = $row["guardian_name"];
	$guardianRelationship = $row["guardian_relationship"];
	$guardianAddress = $row["guardian_address"];
	$guardianCity = $row["guardian_city"];
	$guardianState = $row["guardian_state_id"];
	$guardianZip = $row["guardian_zip"];
	
	####################################################
	$guardianCounty = $row["guardian_county"];
	####################################################
	
	$guardianHomePhone = $row["guardian_home_phone"];
	$guardianWorkPhone = $row["guardian_work_phone"];
	$applicantSig = $row["applicant_signature"];
	
	$applicantSigDate = $row["applicant_signature_date"];
	if($applicantSigDate) {
		$applicantSigDateMonth = substr($applicantSigDate, 5, 2);
		$applicantSigDateDay = substr($applicantSigDate, 8, 2);
		$applicantSigDateYear = substr($applicantSigDate, 0, 4);
	}
	
	$guardianSig = $row["guardian_signature"];
	
	$guardianSigDate = $row["guardian_signature_date"];
	if($guardianSigDate) {
		$guardianSigDateMonth = substr($guardianSigDate, 5, 2);
		$guardianSigDateDay = substr($guardianSigDate, 8, 2);
		$guardianSigDateYear = substr($guardianSigDate, 0, 4);
	}
	
	################################################################
	$witnessSig = $row["witness_signature"];
	#WINTESS SIGNATURE DATES
	$witnessSigDate = $row["witness_signature_date"];
	if($witnessSigDate) {
		$witnessSigDateMonth = substr($witnessSigDate, 5, 2);
		$witnessSigDateDay = substr($witnessSigDate, 8, 2);
		$witnessSigDateYear = substr($witnessSigDate, 0, 4);
	}
	################################################################
	
	$staffSig = $row["staff_signature"];
	$staffSigDate = $row["staff_signature_date"];
	if($staffSigDate) {
		$staffSigDateMonth = substr($staffSigDate, 5, 2);
		$staffSigDateDay = substr($staffSigDate, 8, 2);
		$staffSigDateYear = substr($staffSigDate, 0, 4);
	}
	
	$applicantGrievanceSig = $row["applicant_grievance_signature"];
	
	$applicantGrievanceSigDate = $row["applicant_grievance_signature_date"];
	if($applicantGrievanceSigDate) {
		$applicantGrievanceSigDateMonth = substr($applicantGrievanceSigDate, 5, 2);
		$applicantGrievanceSigDateDay = substr($applicantGrievanceSigDate, 8, 2);
		$applicantGrievanceSigDateYear = substr($applicantGrievanceSigDate, 0, 4);
	}
	
	$guardianGrievanceSig = $row["guardian_grievance_signature"];
	
	$guardianGrievanceSigDate = $row["guardian_grievance_signature_date"];
	if($guardianGrievanceSigDate) {
		$guardianGrievanceSigDateMonth = substr($guardianGrievanceSigDate, 5, 2);
		$guardianGrievanceSigDateDay = substr($guardianGrievanceSigDate, 8, 2);
		$guardianGrievanceSigDateYear = substr($guardianGrievanceSigDate, 0, 4);
	}
	
	#####################################################################3
	#WITNESS GRIEVANCE DATES
	$witnessGrievanceSig = $row["witness_grievance_signature"];
	$witnessGrievanceSigDate = $row["witness_grievance_signature_date"];
	if($witnessGrievanceSigDate) {
		$witnessGrievanceSigDateMonth = substr($witnessGrievanceSigDate, 5, 2);
		$witnessGrievanceSigDateDay = substr($witnessGrievanceSigDate, 8, 2);
		$witnessGrievanceSigDateYear = substr($witnessGrievanceSigDate, 0, 4);
	}
	#####################################################################
	
	$staffGrievanceSig = $row["staff_grievance_signature"];
	$staffGrievanceSigDate = $row["staff_grievance_signature_date"];
	if($staffGrievanceSigDate) {
		$staffGrievanceSigDateMonth = substr($staffGrievanceSigDate, 5, 2);
		$staffGrievanceSigDateDay = substr($staffGrievanceSigDate, 8, 2);
		$staffGrievanceSigDateYear = substr($staffGrievanceSigDate, 0, 4);
	}

}  else {
	//no data was retrieved from db so set date values
	$staffGrievanceSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$staffGrievanceSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$staffGrievanceSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$guardianGrievanceSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$guardianGrievanceSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$guardianGrievanceSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$applicantGrievanceSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$applicantGrievanceSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$applicantGrievanceSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$witnessGrievanceSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$witnessGrievanceSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$witnessGrievanceSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	
	$staffSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$staffSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$staffSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$guardianSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$guardianSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$guardianSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$applicantSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$applicantSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$applicantSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	$witnessSigDateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$witnessSigDateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$witnessSigDateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	
	
}
?>


<form action="actions/ProcessIntake2.php" method="post"/>
	<div style="border:1px #ddd solid;padding:3px;">
		<h2>Intake Page 2</h2>
			<table class="table2">
				<tr>
					<td colspan="3"><h3>Your Legal Status</h3></td>
				</tr>
				<tr>
					<td width="33%">
						<div class="formUnitVertical">
							<label>Are you your own guardian?</label>
							<br/>
							<select name="isGuardian">
								<option <?php if($isGuardian==1) echo "selected "?> value="1">Yes</option>
								<option <?php if($isGuardian==0) echo "selected "?> value="0">No</option>
							</select>
						</div>
					</td>
					<td width="33%">
						<div class="formUnitVertical">
							<label>Is Guardianship Documented?</label>
							<br/>
							<select name="isGuardianshipDocumented">
								<option <?php if($isGuardianshipDocumented==1) echo "selected "?> value="1">Yes</option>
								<option <?php if($isGuardianshipDocumented==0) echo "selected "?> value="0">No</option>
							</select>
						</div>
					</td>
					<td width="33%">
						<div class="formUnitVertical">
							<label>Status</label>
							<br/>
							<select name="legalStatus">
							<option value=""> --- </option>
							<?php
							//get list of programs 
							$legalStatusQuery = "SELECT * FROM lst_legal_status";
							//result
							$legalStatusResult = mysql_query($legalStatusQuery);
						
							while($row=mysql_fetch_array($legalStatusResult)) {
								$status_id1 = $row["legal_status_id"];
								$status_name1 = $row["legal_status_type"];
								
								//check for stored data
								if($legalStatusID1==$status_id1)
									//if objective is stored, make sure its selected
										echo "<option value=\"".$status_id1."\" selected>".$status_name1."</option>";
									else
										echo "<option value=\"".$status_id1."\">".$status_name1."</option>";	
				
							}?>
							</select>
					</td>
				</tr>
				<tr>
					<td>
						<div class="formUnitVertical">
							<label>Guardian's Name:</label>
							<br/>
							<input type="text" name="guardianName" value="<?php echo $guardianName; ?>"/>
						</div>
					</td>
					<td>
						<div class="formUnitVertical">
							<label>Relationship:</label>
							<br/>
							<input type="text" name="guardianRelationship" value="<?php echo $guardianRelationship; ?>"/>
						</div>
					</td>
					<td>
						<div class="formUnitVertical">
							<label>Home Phone:</label>
							<br/>
							<input type="text" name="guardianHomePhone" value="<?php echo $guardianHomePhone; ?>"/>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="formUnitVertical" style="width:250px">
							<label>Address:</label>
							<br/>
							<input type="text" name="guardianAddress" value="<?php echo $guardianAddress; ?>" style="width:350px"/>
						</div>
					</td>
					<td>
						<div class="formUnitVertical">
							<label>Work Phone:</label>
							<br/>
							<input type="text" name="guardianWorkPhone" value="<?php echo $guardianWorkPhone; ?>"/>
						</div>
					</td>
				</tr>
				<tr>
					<td width="15%">
						<div class="formUnitVertical">
							<label>City:</label>
							<br/>
							<input type="text" name="guardianCity" value="<?php echo $guardianCity; ?>"/>
						</div>
					</td>
					<td width="15%">
						<div class="formUnitVertical">
							<label>State:</label>
							<br/>
							<select name="guardianState">
							<?php 
								$stateQuery = "select * from lst_state";
								$result = mysql_query($stateQuery);
								while($row=mysql_fetch_array($result)) {
									$state_id = $row["id"];
									$abbr = $row["abbr"];
									
									if($guardianState==$state_id)
										echo "<option value=\"".$state_id."\" selected>".$abbr."</option>";
									else
										echo "<option value=\"".$state_id."\">".$abbr."</option>";
								}
							?>
							</select>
						</div>
					</td>
					<td width="15%">
						<div class="formUnitVertical">
							<label>Zip:</label>
							<br/>
							<input type="text" name="guardianZip" style="width:60px" value="<?php echo $guardianZip; ?>"/>
						</div>
					</td>
					<td width="15%">
						<div class="formUnitVertical">
							<label>County:</label>
							<br/>
							<input type="text" name="guardianCounty" style="width:60px" value="<?php echo $guardianCounty; ?>"/>
						</div>
					</td>
				</tr>
<?php
###########################
### 	LEGAL STATUS SIGNATURES
###########################
?>
				<tr>
					<td colspan="3">
						<table class="table2">
<?php
### 	CONSUMER SIG 
?>
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Consumer's Signature:</label>
										<br/>
										<input type="text" name="applicantSig" value="<?php echo $applicantSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="applicantSigDate">Date</label>
										<br/>
										<select name="applicantSigDateMonth" id="applicantSigDateMonth">
								                  <option value="01">January</option>
								                  <option value="02">February</option>
								                  <option value="03">March</option>
								                  <option value="04">April</option>
								                  <option value="05">May</option>
								                  <option value="06">June</option>
								                  <option value="07">July</option>
								                  <option value="08">August</option>
								                  <option value="09">September</option>
								                  <option value="10">October</option>
								                  <option value="11">November</option>
								                  <option value="12">December</option>
										</select>
										<script>					
											for(i=0; i<$('applicantSigDateMonth').options.length; i++) {
												if($('applicantSigDateMonth').options[i].value=='<? echo $applicantSigDateMonth ?>') {
													$('applicantSigDateMonth').options[i].selected = true;
												}
											}
										</script>
										<select name="applicantSigDateDay" id="applicantSigDateDay">
										<?php 
										            for($i=1; $i<32; $i++) {
													if($i<10)
														echo "<option value=\"0".$i."\">".$i."</option>";
													else
														echo "<option value=\"".$i."\">".$i."</option>";
										            }
										?>
										</select>
							                <script>					
							            for(i=0; i<$('applicantSigDateDay').options.length; i++) {
							              if($('applicantSigDateDay').options[i].value=='<? echo $applicantSigDateDay ?>') {
							                $('applicantSigDateDay').options[i].selected = true;
							              }
							            }
							          </script>
							                <select name="applicantSigDateYear" id="applicantSigDateYear">
										<?php
										            for($i=0; $i<10; $i++) {
													$year = date("Y", mktime(0,0,0,1,1,date("Y")));
													$year = intval($year) - $i;
													echo "<option value=\"".$year."\">".$year."</option>";
										            }
										?>
							                </select>
							                <script>					
							            for(i=0; i<$('applicantSigDateYear').options.length; i++) {
							              if($('applicantSigDateYear').options[i].value=='<? echo $applicantSigDateYear ?>') {
							                $('applicantSigDateYear').options[i].selected = true;
							              }
							            }
							          </script>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
<?php
### 	GUARDIAN SIG 
?>	
				<tr>
					<td colspan="3">
	
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Guardian's Signature:</label>
										<br/>
										<input type="text" name="guardianSig" value="<?php echo $guardianSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="guardianSigDate">Date</label>
										<br/>
								                <select name="guardianSigDateMonth" id="guardianSigDateMonth">
								                  <option value="01">January</option>
								                  <option value="02">February</option>
								                  <option value="03">March</option>
								                  <option value="04">April</option>
								                  <option value="05">May</option>
								                  <option value="06">June</option>
								                  <option value="07">July</option>
								                  <option value="08">August</option>
								                  <option value="09">September</option>
								                  <option value="10">October</option>
								                  <option value="11">November</option>
								                  <option value="12">December</option>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianSigDateMonth').options.length; i++) {
								              if($('guardianSigDateMonth').options[i].value=='<? echo $guardianSigDateMonth ?>') {
								                $('guardianSigDateMonth').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="guardianSigDateDay" id="guardianSigDateDay">
								                  <?php 
											            for($i=1; $i<32; $i++) {
											              if($i<10)
											                echo "<option value=\"0".$i."\">".$i."</option>";
											              else
											                echo "<option value=\"".$i."\">".$i."</option>";
											            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianSigDateDay').options.length; i++) {
								              if($('guardianSigDateDay').options[i].value=='<? echo $guardianSigDateDay ?>') {
								                $('guardianSigDateDay').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="guardianSigDateYear" id="guardianSigDateYear">
								                  <?php								            
										            for($i=0; $i<10; $i++) {
										              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
										              $year = intval($year) - $i;
										              echo "<option value=\"".$year."\">".$year."</option>";
										            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianSigDateYear').options.length; i++) {
								              if($('guardianSigDateYear').options[i].value=='<? echo $guardianSigDateYear ?>') {
								                $('guardianSigDateYear').options[i].selected = true;
								              }
								            }
								          </script>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
  <?php
### 	WITNESS SIG 
?>	
				<tr>
					<td colspan="3">
	
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Witness Signature:</label>
										<br/>
										<input type="text" name="witnessSig" value="<?php echo $witnessSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="witnessSigDate">Date</label>
										<br/>
								                <select name="witnessSigDateMonth" id="witnessSigDateMonth">
								                  <option value="01">January</option>
								                  <option value="02">February</option>
								                  <option value="03">March</option>
								                  <option value="04">April</option>
								                  <option value="05">May</option>
								                  <option value="06">June</option>
								                  <option value="07">July</option>
								                  <option value="08">August</option>
								                  <option value="09">September</option>
								                  <option value="10">October</option>
								                  <option value="11">November</option>
								                  <option value="12">December</option>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessSigDateMonth').options.length; i++) {
								              if($('witnessSigDateMonth').options[i].value=='<? echo $witnessSigDateMonth ?>') {
								                $('witnessSigDateMonth').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="witnessSigDateDay" id="witnessSigDateDay">
								                  <?php 
											            for($i=1; $i<32; $i++) {
											              if($i<10)
											                echo "<option value=\"0".$i."\">".$i."</option>";
											              else
											                echo "<option value=\"".$i."\">".$i."</option>";
											            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessSigDateDay').options.length; i++) {
								              if($('witnessSigDateDay').options[i].value=='<? echo $witnessSigDateDay ?>') {
								                $('witnessSigDateDay').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="witnessSigDateYear" id="witnessSigDateYear">
								                  <?php								            
										            for($i=0; $i<10; $i++) {
										              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
										              $year = intval($year) - $i;
										              echo "<option value=\"".$year."\">".$year."</option>";
										            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessSigDateYear').options.length; i++) {
								              if($('witnessSigDateYear').options[i].value=='<? echo $witnessSigDateYear ?>') {
								                $('witnessSigDateYear').options[i].selected = true;
								              }
								            }
								          </script>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
  <?php
### 	STAFF SIG 
?>	
				<tr>
					<td colspan="3">
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Staff's Signature:</label>
										<br/>
										<input type="text" name="staffSig" value="<?php echo $staffSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="staffSigDate">Date</label>
										<br/>
							                <select name="staffSigDateMonth" id="staffSigDateMonth">
								                  <option value="01">January</option>
								                  <option value="02">February</option>
								                  <option value="03">March</option>
								                  <option value="04">April</option>
								                  <option value="05">May</option>
								                  <option value="06">June</option>
								                  <option value="07">July</option>
								                  <option value="08">August</option>
								                  <option value="09">September</option>
								                  <option value="10">October</option>
								                  <option value="11">November</option>
								                  <option value="12">December</option>
							                </select>
							                <script>					
							            for(i=0; i<$('staffSigDateMonth').options.length; i++) {
							              if($('staffSigDateMonth').options[i].value=='<? echo $staffSigDateMonth ?>') {
							                $('staffSigDateMonth').options[i].selected = true;
							              }
							            }
							          </script>
							                <select name="staffSigDateDay" id="staffSigDateDay">
							                  <?php 
										            for($i=1; $i<32; $i++) {
										              if($i<10)
										                echo "<option value=\"0".$i."\">".$i."</option>";
										              else
										                echo "<option value=\"".$i."\">".$i."</option>";
										            }?>
							                </select>
							                <script>					
							            for(i=0; i<$('staffSigDateDay').options.length; i++) {
							              if($('staffSigDateDay').options[i].value=='<? echo $staffSigDateDay ?>') {
							                $('staffSigDateDay').options[i].selected = true;
							              }
							            }
							          </script>
							                <select name="staffSigDateYear" id="staffSigDateYear">
							                  <?php
									            for($i=0; $i<10; $i++) {
									              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
									              $year = intval($year) - $i;
									              echo "<option value=\"".$year."\">".$year."</option>";
									            }?>
							                </select>
							                <script>					
							            for(i=0; i<$('staffSigDateYear').options.length; i++) {
							              if($('staffSigDateYear').options[i].value=='<? echo $staffSigDateYear ?>') {
							                $('staffSigDateYear').options[i].selected = true;
							              }
							            }
							          </script>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
<?php
###########################
### 	GRIEVANCE SIGNATURES
###########################
?>
				<tr>
					<td colspan="3"><h3>CONSUMER GRIEVANCE PROCEDURE</h3></td>
				</tr>
				<tr>
					<td colspan="3">
						<table class="table2">
							<tr>
								<td>
									<p> Your participation in <?php echo THIS_CIL;?> services and activities is based
											on your individual goals, objectives, and activities stated in your
											Independent Living Plan (ILP).  If consuemrs are unsatisfied and
								                wish to express concerns regarding service delivery in obtaining
								                your objectives, the following steps must be observed: 
										<strong>
								              <ul style="list-style:decimal; margin:10px 20px;font-weight:bold">
								                <li> Schedule an appointment to address the concerns with the 
								                  appropriate Coordinator. </li>
								                <li> Request a staffing for reconsideration or adjustment to the 
								                  objectives. </li>
								                <li> Submit a grievance (typed or in writing) to the Deputy Director. </li>
								              </ul>
								              </strong> An investigation will be conducted and a written response will be
								              submitted within ten (10) working days.
								              </p>
								              <p> You may appeal the decision about your complaint by notifying the
								                Deputy Director.  You may want to provide more information about the
								                situation or why you think the decision is unfair. </p>
								              <p> Your appeal will be decided by the Executive Director. </p>
								              <p> If you have any further questions about this procedure, please talk with 
								                your ILP staff designate at <?php echo THIS_CIL;?>. </p>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
<?php
### 	CONSUMER GRIEVANCE SIG 
?>	
					<td colspan="3">
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Consumer's Signature:</label>
										<br/>
										<input type="text" name="applicantGrievanceSig" value="<?php echo $applicantGrievanceSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="applicantGrievanceSigDate">Date</label>
										<br/>
							                <select name="applicantGrievanceSigDateMonth" id="applicantGrievanceSigDateMonth">
								                  <option value="01">January</option>
								                  <option value="02">February</option>
								                  <option value="03">March</option>
								                  <option value="04">April</option>
								                  <option value="05">May</option>
								                  <option value="06">June</option>
								                  <option value="07">July</option>
								                  <option value="08">August</option>
								                  <option value="09">September</option>
								                  <option value="10">October</option>
								                  <option value="11">November</option>
								                  <option value="12">December</option>
							                </select>
							                <script>					
							            for(i=0; i<$('applicantGrievanceSigDateMonth').options.length; i++) {
							              if($('applicantGrievanceSigDateMonth').options[i].value=='<? echo $applicantGrievanceSigDateMonth ?>') {
							                $('applicantGrievanceSigDateMonth').options[i].selected = true;
							              }
							            }
							          </script>
							                <select name="applicantGrievanceSigDateDay" id="applicantGrievanceSigDateDay">
							                  <?php 
										         for($i=1; $i<32; $i++) {
										              if($i<10)
										                echo "<option value=\"0".$i."\">".$i."</option>";
										              else
										                echo "<option value=\"".$i."\">".$i."</option>";
											}?>
								                </select>
								                <script>					
								            for(i=0; i<$('applicantGrievanceSigDateDay').options.length; i++) {
								              if($('applicantGrievanceSigDateDay').options[i].value=='<? echo $applicantGrievanceSigDateDay ?>') {
								                $('applicantGrievanceSigDateDay').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="applicantGrievanceSigDateYear" id="applicantGrievanceSigDateYear">
								                  <?php
									            for($i=0; $i<10; $i++) {
									              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
									              $year = intval($year) - $i;
									              echo "<option value=\"".$year."\">".$year."</option>";
									            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('applicantGrievanceSigDateYear').options.length; i++) {
								              if($('applicantGrievanceSigDateYear').options[i].value=='<? echo $applicantGrievanceSigDateYear ?>') {
								                $('applicantGrievanceSigDateYear').options[i].selected = true;
								              }
								            }
								          </script>
									</div>
								</td>
							</tr>
						</table>
					</td>
				</tr>
<?php
### 	GUARDIAN GRIEVANCE SIG 
?>	
				<tr>
					<td colspan="3">
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Guardian's Signature:</label>
										<br/>
										<input type="text" name="guardianGrievanceSig" value="<?php echo $guardianGrievanceSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="guardianGrievanceSigDate">Date</label>
										<br/>
								                <select name="guardianGrievanceSigDateMonth" id="guardianGrievanceSigDateMonth">
									                  <option value="01">January</option>
									                  <option value="02">February</option>
									                  <option value="03">March</option>
									                  <option value="04">April</option>
									                  <option value="05">May</option>
									                  <option value="06">June</option>
									                  <option value="07">July</option>
									                  <option value="08">August</option>
									                  <option value="09">September</option>
									                  <option value="10">October</option>
									                  <option value="11">November</option>
									                  <option value="12">December</option>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianGrievanceSigDateMonth').options.length; i++) {
								              if($('guardianGrievanceSigDateMonth').options[i].value=='<? echo $guardianGrievanceSigDateMonth ?>') {
								                $('guardianGrievanceSigDateMonth').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="guardianGrievanceSigDateDay" id="guardianGrievanceSigDateDay">
								                  <?php 
											            for($i=1; $i<32; $i++) {
											              if($i<10)
											                echo "<option value=\"0".$i."\">".$i."</option>";
											              else
											                echo "<option value=\"".$i."\">".$i."</option>";
											            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianGrievanceSigDateDay').options.length; i++) {
								              if($('guardianGrievanceSigDateDay').options[i].value=='<? echo $guardianGrievanceSigDateDay ?>') {
								                $('guardianGrievanceSigDateDay').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="guardianGrievanceSigDateYear" id="guardianGrievanceSigDateYear">
								                  <?php
										            for($i=0; $i<10; $i++) {
										              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
										              $year = intval($year) - $i;
										              echo "<option value=\"".$year."\">".$year."</option>";
										            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('guardianGrievanceSigDateYear').options.length; i++) {
								              if($('guardianGrievanceSigDateYear').options[i].value=='<? echo $guardianGrievanceSigDateYear ?>') {
								                $('guardianGrievanceSigDateYear').options[i].selected = true;
								              }
								            }
								          </script>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
<?php
### 	WITNESS GRIEVANCE SIG 
?>	
				<tr>
					<td colspan="3">
						<table class="table2">
							<tr>
								<td>
									<div class="formUnitVertical" style="width:375px">
										<label>Witness Signature:</label>
										<br/>
										<input type="text" name="witnessGrievanceSig" value="<?php echo $witnessGrievanceSig; ?>" style="width:350px"/>
									</div>
								</td>
								<td>
									<div class="formUnitVertical">
										<label for="witnessGrievanceSigDate">Date</label>
										<br/>
								                <select name="witnessGrievanceSigDateMonth" id="witnessGrievanceSigDateMonth">
									                  <option value="01">January</option>
									                  <option value="02">February</option>
									                  <option value="03">March</option>
									                  <option value="04">April</option>
									                  <option value="05">May</option>
									                  <option value="06">June</option>
									                  <option value="07">July</option>
									                  <option value="08">August</option>
									                  <option value="09">September</option>
									                  <option value="10">October</option>
									                  <option value="11">November</option>
									                  <option value="12">December</option>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessGrievanceSigDateMonth').options.length; i++) {
								              if($('witnessGrievanceSigDateMonth').options[i].value=='<? echo $witnessGrievanceSigDateMonth ?>') {
								                $('witnessGrievanceSigDateMonth').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="witnessGrievanceSigDateDay" id="witnessGrievanceSigDateDay">
								                  <?php 
											            for($i=1; $i<32; $i++) {
											              if($i<10)
											                echo "<option value=\"0".$i."\">".$i."</option>";
											              else
											                echo "<option value=\"".$i."\">".$i."</option>";
											            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessGrievanceSigDateDay').options.length; i++) {
								              if($('witnessGrievanceSigDateDay').options[i].value=='<? echo $witnessGrievanceSigDateDay ?>') {
								                $('witnessGrievanceSigDateDay').options[i].selected = true;
								              }
								            }
								          </script>
								                <select name="witnessGrievanceSigDateYear" id="witnessGrievanceSigDateYear">
								                  <?php
										            for($i=0; $i<10; $i++) {
										              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
										              $year = intval($year) - $i;
										              echo "<option value=\"".$year."\">".$year."</option>";
										            }?>
								                </select>
								                <script>					
								            for(i=0; i<$('witnessGrievanceSigDateYear').options.length; i++) {
								              if($('witnessGrievanceSigDateYear').options[i].value=='<? echo $witnessGrievanceSigDateYear ?>') {
								                $('witnessGrievanceSigDateYear').options[i].selected = true;
								              }
								            }
								          </script>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
<?php
### 	STAFF GRIEVANCE SIG 
?>	
    <tr>
      <td colspan="3"><table class="table2">
          <tr>
            <td><div class="formUnitVertical" style="width:375px">
                <label>Staff's Signature:</label>
                <br/>
                <input type="text" name="staffGrievanceSig" value="<?php echo $staffGrievanceSig; ?>" style="width:350px"/>
              </div></td>
            <td><div class="formUnitVertical">
                <label for="staffGrievanceSigDate">Date</label>
                <br/>
                <select name="staffGrievanceSigDateMonth" id="staffGrievanceSigDateMonth">
                  <option value="01">January</option>
                  <option value="02">February</option>
                  <option value="03">March</option>
                  <option value="04">April</option>
                  <option value="05">May</option>
                  <option value="06">June</option>
                  <option value="07">July</option>
                  <option value="08">August</option>
                  <option value="09">September</option>
                  <option value="10">October</option>
                  <option value="11">November</option>
                  <option value="12">December</option>
                </select>
                <script>					
            for(i=0; i<$('staffGrievanceSigDateMonth').options.length; i++) {
              if($('staffGrievanceSigDateMonth').options[i].value=='<? echo $staffGrievanceSigDateMonth ?>') {
                $('staffGrievanceSigDateMonth').options[i].selected = true;
              }
            }
          </script>
                <select name="staffGrievanceSigDateDay" id="staffGrievanceSigDateDay">
                  <?php 
            for($i=1; $i<32; $i++) {
              if($i<10)
                echo "<option value=\"0".$i."\">".$i."</option>";
              else
                echo "<option value=\"".$i."\">".$i."</option>";
            }?>
                </select>
                <script>					
            for(i=0; i<$('staffGrievanceSigDateDay').options.length; i++) {
              if($('staffGrievanceSigDateDay').options[i].value=='<? echo $staffGrievanceSigDateDay ?>') {
                $('staffGrievanceSigDateDay').options[i].selected = true;
              }
            }
          </script>
                <select name="staffGrievanceSigDateYear" id="staffGrievanceSigDateYear">
                  <?php
            
            for($i=0; $i<10; $i++) {
              $year = date("Y", mktime(0,0,0,1,1,date("Y")));
              $year = intval($year)-$i;
              echo "<option value=\"".$year."\">".$year."</option>";
            }?>
                </select>
                <script>					
            for(i=0; i<$('staffGrievanceSigDateYear').options.length; i++) {
              if($('staffGrievanceSigDateYear').options[i].value=='<? echo $staffGrievanceSigDateYear ?>') {
                $('staffGrievanceSigDateYear').options[i].selected = true;
              }
            }
          </script>
              </div></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td colspan="3" align="right"><input type="hidden" value="<?php echo $id;?>" name="id" />
        <input type="submit" class="btn" value="Submit"/>
        <input class="btn" type="button" value="Cancel" 
      			onclick="window.location='admin.php?action=cieedit&id=<?php echo $id;?>';"/>
      </td>
    </tr>
  </table>
</div>
<br/>
<br/>
</form>
